//
//  CinemaTableViewCell.m
//  豆瓣YHY
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "CinemaTableViewCell.h"

@implementation CinemaTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self zz];
    }
    return self;
}
+ (CGFloat)heightWithStr:(NSString *)str
{
    
    CGRect frame = [str boundingRectWithSize:CGSizeMake([[UIScreen mainScreen] bounds].size.width - 2 * 10, 2000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:18.0] forKey:NSFontAttributeName] context:nil];
    
    return frame.size.height;
    
}
- (void)zz{
    //背景图片
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 350, 180)];
    image.image = [UIImage imageNamed:@"bg_eventlistcell.png"];
    [self.contentView addSubview:image];
    
    //影院名称
    self.cinemaName = [[UILabel alloc]initWithFrame:CGRectMake(20, 30, 200, 50)];
   
   // self.cinemaName.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.cinemaName];
    NSLog(@"xx");
    //地址
    self.addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 90, 350, 50)];
 
   // self.addressLabel.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.addressLabel];
    //电话
    self.telePhoneLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 150, 200, 30)];
   // self.telePhoneLabel.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.telePhoneLabel];
    
    
    
    
}

- (void)setCinema:(Cinema *)cinema{
    if (_cinema != cinema) {
        [_cinema release];
        _cinema  = [cinema retain];
    }
    self.cinemaName.text = self.cinema.cinemaName;
    self.addressLabel.text = self.cinema.address;
    self.telePhoneLabel.text = self.cinema.telephone;
    
    CGFloat height = [[self class] heightWithStr:self.cinema.cinemaName];
   
   
}






- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
